home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / fmodla13.zip / DISPLAY.DEF < prev    next >
Text File  |  1992-01-29  |  5KB  |  166 lines

  1. DEFINITION MODULE Display;
  2.  
  3. (* (C) Copyright 1987 Fitted Software Tools. All rights reserved. *)
  4.  
  5. FROM SYSTEM IMPORT ADDRESS;
  6.  
  7.  
  8. VAR displayMode :CARDINAL;              (* initialized to current mode *)
  9.     displayPage :CARDINAL;              (* initialized from current mode *)
  10.     displayAttr :CARDINAL;              (* initialized to 07H *)
  11.     displayLines:CARDINAL;              (* initialized to 25 *)
  12.     displayCols :CARDINAL;              (* initialized from current mode *)
  13.     snowy       :BOOLEAN;               (* wait for retrace on video IO *)
  14.                                         (* init TRUE if displayMode <> 7 *)
  15.  
  16. (*
  17.     -------------------------------------------------------------
  18.     BIOS interface routines.
  19.     The following procedures do their work through the PC's BIOS.
  20.     -------------------------------------------------------------
  21. *)
  22.  
  23. PROCEDURE GetDisplayMode( VAR mode, nCols, activePage :CARDINAL );
  24. (*
  25.     Returns current display mode.
  26. *)
  27.  
  28. PROCEDURE SetDisplayMode( mode :CARDINAL );
  29. (*
  30.     Sets the display mode.
  31. *)
  32.  
  33. PROCEDURE SetCursorType( start, end :CARDINAL );
  34. (*
  35.     Set the cursor starting and ending lines.
  36. *)
  37.  
  38. PROCEDURE GetCursorPosition( VAR line :CARDINAL; VAR pos :CARDINAL );
  39. (*
  40.     Returns the current cursor position.
  41. *)
  42.  
  43. PROCEDURE SetCursorPosition( line :CARDINAL; pos :CARDINAL );
  44. (*
  45.     Moves the cursor to line/pos.
  46. *)
  47.  
  48. PROCEDURE ScrollUp( n, line1, pos1, line2, pos2 :CARDINAL; attr :CARDINAL );
  49. (*
  50.     Scrolls window up n lines.
  51.      line1, pos1 = top left corner of the window to scroll.
  52.      line2, pos2 = bottom right corner of the window.
  53.      attr is attribute for new blank lines.
  54.      IF n = 0 THEN ClearWindow.
  55. *)
  56.  
  57. PROCEDURE ScrollDown( n, line1, pos1, line2, pos2 :CARDINAL; attr :CARDINAL );
  58. (*
  59.     Scrolls window down n lines.
  60. *)
  61.  
  62. PROCEDURE ReadCharAttr( VAR ch :CHAR; VAR attr :CARDINAL );
  63. (*
  64.     Reads the character and attribute under the cursor.
  65. *)
  66.  
  67. PROCEDURE WriteCharAttr( ch :CHAR; attr :CARDINAL );
  68. (*
  69.     Writes the character and attribute at current cursor location.
  70.     The cursor is not moved.
  71. *)
  72.  
  73. PROCEDURE WriteChar( ch :CHAR );
  74. (*
  75.     Writes ch at the current cursor location.
  76. *)
  77.  
  78.  
  79. (*
  80.     -----------------------------------------------------------------
  81.     The following procedures work within the bowdaries of the current
  82.     window as defined by line0,col0-lineN,colN.
  83.     -----------------------------------------------------------------
  84. *)
  85.  
  86. VAR
  87.     (* current window coordinates *)
  88.     line0       :CARDINAL;              (* top line, init 0 *)
  89.     col0        :CARDINAL;              (* leftmost col, init 0 *)
  90.     lineN       :CARDINAL;              (* last line in window *)
  91.     colN        :CARDINAL;              (* last col in window *)
  92.  
  93. PROCEDURE Goto( line, col :CARDINAL );
  94. (*
  95.     moves the cursor to line/pos within the current window
  96. *)
  97.  
  98. PROCEDURE Write( ch :CHAR );
  99. (*
  100.     Writes the character at the current screen location, using displayAttr,
  101.     and advances the cursor.
  102.  
  103.     The following control characters are processed:
  104.         BEL, EOL, CR, LF, FF, DEL, BS, HT.
  105. *)
  106.  
  107. PROCEDURE ClrEOL;
  108. (*
  109.     clear to the end of the line (uses displayAttr)
  110. *)
  111.  
  112. PROCEDURE ClrEOS;
  113. (*
  114.     clear to the end of the window (uses displayAttr)
  115. *)
  116.  
  117.  
  118. (*
  119.     ------------------------------------------------------------
  120.     The following procedures work only in text mode!
  121.     They provide a fast means of updating the screen by writing
  122.     directly to the display adapter's memory.
  123.     ------------------------------------------------------------
  124. *)
  125.  
  126. TYPE DisplayBuffer = ARRAY [0..24] OF ARRAY [0..79] OF CARDINAL;
  127.  
  128. VAR
  129.     displayPtr  :POINTER TO DisplayBuffer;  (* loaded at initialization time *)
  130.  
  131.  
  132. PROCEDURE DisplayString( s :ARRAY OF CHAR; line, pos :CARDINAL; attr :CARDINAL );
  133. (*
  134.     Writes the string directly into the display buffer.
  135.     line and pos are relative to the current window.
  136.  
  137.     The cursor is not moved and control characters are not processed.
  138. *)
  139. (*
  140.     end of window related procedures
  141.     --------------------------------
  142. *)
  143.  
  144.  
  145. PROCEDURE DisplayLine( line :ARRAY OF CHAR; lineno :CARDINAL; attr :CARDINAL );
  146. (*
  147.     Writes an 80 character line directly into the display buffer.
  148.      attr is the attribute character to be used.
  149.      If length(line) < 80, fill w/ spaces.
  150. *)
  151.  
  152. PROCEDURE WriteScreen( src, dest :ADDRESS; nWords :CARDINAL );
  153. (*
  154.     Moves src to dest for nWords.
  155.     dest is assumed to be within the display buffer.
  156.     Monitors the vertical retrace signal if snowy = TRUE.
  157. *)
  158.  
  159. PROCEDURE ReadScreen( src, dest :ADDRESS; nWords :CARDINAL );
  160. (*
  161.     Moves src to dest for nWords.
  162.     src is assumed to be within the display buffer.
  163.     Monitors the vertical retrace signal if snowy = TRUE.
  164. *)
  165.  
  166. END Display.